<template>
	<view>
		<view class="title">热门分类</view>
		<view class="class-list">
			<view class="class-item" v-for="(item,i) in classList" :key="i" @click="onClassClick(item.id)"
				:class="{active:item.id==currentClass}">{{item.label}}</view>
		</view>
		<button type="default" class="next-btn" @click="onNextClick">下一步</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currentClass: "",
				classList: [{
					id: 1,
					label: "餐饮服务1"
				}, {
					id: 2,
					label: "餐饮服务2"
				}, {
					id: 3,
					label: "餐饮服务3"
				}, {
					id: 4,
					label: "餐饮服务4"
				}, {
					id: 5,
					label: "餐饮服务5"
				}, {
					id: 6,
					label: "餐饮服务6"
				}]
			}
		},
		methods: {
			onClassClick: function(val) {
				this.currentClass = val;
			},
			onNextClick: function() {
				uni.navigateTo({
					url: '/pages/index/publish'
				})
			}
		}
	}
</script>

<style>
	.title {
		margin: 40rpx 32rpx;
		background: url(../../static/images/icon_select_fenlei@3x.png) 0rpx center no-repeat #FFFFFF;
		background-size: 32rpx;
		padding-left: 40rpx;
		color: #000;
		font-size: 32rpx;
	}

	.class-list {
		margin: 40rpx 32rpx;
		font-size: 0;
	}

	.class-item:nth-child(3n) {
		margin-right: 0;
	}

	.class-item {
		width: 210rpx;
		height: 74rpx;
		line-height: 74rpx;
		background: #F4F4F4;
		border-radius: 4rpx;
		font-size: 28rpx;
		color: #7B7B7B;
		text-align: center;
		display: inline-block;
		margin-bottom: 40rpx;
		margin-right: 28rpx;
		border: 1px solid transparent;
	}

	.class-item.active {
		background: rgba(19, 113, 255, 0.1);
		border: 2rpx solid #1371FF;
		color: #1371FF;
	}

	.next-btn {
		position: fixed;
		bottom: 98rpx;
	}
</style>
